<?php

 session_start();
require('config/conn.php');
 header("Content-Type:text/html; charset=utf-8");
$userName = trim($_POST['username']);
$passWord = md5(trim( $_POST['password']));
if($userName && trim( $_POST['password'])){	
	$regResult = mysql_query("insert into user (username,password) value('$userName','$passWord')");
}
if($regResult){
	$_SESSION['username'] = $userName;
header('Location:register_success.php');	
}else{
	echo '<p style="text-align:center;margin-top:80px;">注册失败! &nbsp;&nbsp;<a href="register.html">返回</a></p>';
}
?>
